#include "renderer.h"
#include <cstdio>

void RRRenderer::rrBegin(RRPrimType type)
{
  prim1.rrSetType(type);
}

void RRRenderer::rrEnd()
{
  clipping.rrClipping(&prim1, &prim2);
}

void RRRenderer::rrSetVert3f(float x, float y, float z)
{
  vert.x = x; vert.y = y; vert.z = z; vert.w = 1.0f;
  vert.c[0] = color[0]; vert.c[1] = color[1];
  vert.c[2] = color[2]; vert.c[3] = color[3];

  prim1.rrSetVert(vert);
}

void RRRenderer::rrColor4f(float a, float r, float g, float b)
{
  color[0] = a; color[1] = r;
  color[2] = g; color[3] = b;
}

void RRRenderer::rrPrintVert(int index)
{
  RRVertex temp;
  temp = prim2.rrGetVert(index);
  printf("%f, %f, %f\n", temp.x, temp.y, temp.z);
  printf("%f, %f, %f, %f\n", temp.c[0], temp.c[1], temp.c[2], temp.c[3]);
}
